#include <iostream>
using namespace std;

class Solution {
public:
    int reverseBits(int num) {
        int ans = 0;
        bool flag = false;
        int l = 0,r = 0;
        int next = 0;
        while(r < 32)
        {
            if((num & 1) == 0)
            {
                if(!flag)
                {
                    next = r + 1;
                    flag = true;
                }
                else
                {
                    ans = max(r - l,ans);
                    l = next;
                    next = r + 1;
                }
            }
            ++ r;
            num = num >> 1;
        }
        return max(r - l,ans);
    }
};

int main()
{
    return 0;
}